<!doctype html>
<html>

	<head>
		<meta charset="utf-8">
		<title></title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="../css/mui.min.css" rel="stylesheet" />
		<link rel="stylesheet" href="css/index.css">
		<link rel="stylesheet" type="text/css" href="../css/mui.picker.min.css"/>
		<link rel="stylesheet" type="text/css" href="../css/mui.poppicker.css"/>
		<link rel="stylesheet" type="text/css" href="../css/lcs-pop.css"/>
		<link rel="stylesheet" type="text/css" href="css/empcss.css"/>
		<link rel="stylesheet" type="text/css" href="css/compatible.css"/>
		<script type="text/javascript">
			var setData = {date_type:"date", date:"today"};
		</script>
	</head>
	<body>
		<header class="mui-bar mui-bar-nav hbg ">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left colorw"></a>
		    <h1 class="mui-title">销售统计</h1>
		</header>
		<div class="mui-content">
		    
		
		<mian id="content">
			<section class="mui-content financial-tab text-center" data-url='/api/product/sell_census'>
				<ul class="mui-row">
					<li class="mui-col-xs-6" onclick="tab(event, storeChange)"> <!--onclick="tab(event, paytype)"-->
						<p>门店</p>
						<div class="financial-subtab curStore" data-store="">
							<!-- <span data-name="all">全部途径</span>
							<span data-name="普通支付">普通支付</span>
							<span data-name="现金支付">现金支付</span>
							<span data-name="移动支付">移动支付</span>
							<span data-name="微信支付">微信支付</span>
							<span data-name="支付宝支付">支付宝支付</span>
							<span data-name="其它">其它</span> -->
						</div>
					</li>
					<li class="mui-col-xs-6" onclick="tab(event, changeDate)">
						<p>今日</p>
						<div class="financial-subtab">
							<span data-type="date" data-date="today">今天</span>
							<span data-type="date" data-date="yesterday">昨天</span>
							<span data-type="custom" data-date="week">本周</span>
							<span data-type="custom" data-date="month">本月</span>
							<span class="none" onclick="timeStep(event)">时间段</span>
						</div>
					</li>
				</ul>
			</section>
			<section class="salce-tab mui-content container">
				<ul class="mui-row">
					<li class="mui-col-xs-6 mui-col-offset-6 right"><span>总收入</span><b id="sell_money_all">0</b></li>
					<li class="mui-col-xs-6"><span>总件数</span><b id="product_number_all">0</b>件</li>
					<li class="mui-col-xs-6"><span>总利润</span><b id="profit_money_all">0</b></li>
				</ul>
			</section>
			<section class="salce-lists container"></section>

			<div id="popover" class="mui-popover">
				<div class="listdiv">
					<div class="mui-input-row borbot" >
						<label>开始时间:</label>
						<div class="place items">
							<button id='starttime' data-time="" onclick="changTime(event)" type="button" class="mui-btn mui-btn-blue mui-btn-outlined">开始时间</button>
						</div>
					</div> 
					<div class="mui-input-row borbot" >
						<label>结束时间:</label>
						<div class="place items">
							<button id='endtime' data-time="" onclick="changTime(event)" type="button" class="mui-btn mui-btn-blue mui-btn-outlined">结束时间</button>
						</div>
					</div>
					<button type="button" id="okbut" class="mui-btn mui-btn-blue mui-btn-block">确定</button>
				</div>
			</div>
		</mian>
		</div>
	</body>
	<script src="../js/jquery.min.js" type="text/javascript" charset="utf-8"></script>
	<script src="../js/mui.min.js"></script>
	<script src="js/echarts.js"></script>
	<script src="../js/muishow.js" type="text/javascript" charset="utf-8"></script>
	<script src="../js/req.js" type="text/javascript" charset="utf-8"></script>
	<script src="../js/mui.picker.min.js" type="text/javascript" charset="utf-8"></script>
	<script src="../js/mui.poppicker.js" type="text/javascript" charset="utf-8"></script>
	<script src="../js/city.data.js" type="text/javascript" charset="utf-8"></script>
	<script src="../js/city.data-3.js" type="text/javascript" charset="utf-8"></script>
	<script src="js/commont.js"></script>
	<script type="text/javascript">
		//mui.init()
		
		function requireData(_data){

			var store = $('.curStore').data('store');
			if(!!store){
				_data['data']['store_id'] = store
			}else{
				delete _data['data']['store_id']
			}
			_data['data'].access_token = acctoken()

			ajax(_data, function (res){
				var data = res.data;
				var html = []
				
				if(data.product.length > 0){
					data.product.forEach(function (cur, index){
						var tpl = `<div class="salce-lists-item clear" > 
							<div class="pull-left salce-item-img"><img src="${cur['product_images_path']}" onerror="imgError(this)" width="70" height="70" alt=""></div>
							<div class="pull-left salce-item-info">
								<h3>${cur.product_name} <i class="mui-icon mui-icon-closeempty"></i>${cur['product_number']}</h3>
								<!-- <p>${cur.time}</p> -->
							</div>
							<div class="pull-left salce-item-jq">
								<p>${cur.product_price}</p>
								<p>￥${cur.all_product_price}</p>
							</div>
						</div>`;
						
						html.push(tpl)
					})
					
				}
				
				$('.salce-lists').html(html.join(''))
				
				$('#sell_money_all').text(data.sell_money_all)
				$('#profit_money_all').text(data.profit_money_all)
				$('#product_number_all').text(data.product_number_all)
			})
		}
		
		function imgError(_this){
			_this.setAttribute('src', '../img/noimg.png');
		}

		requireData({
			url : '/api/product/sell_census',
			data : {
				date_type : 'data',
				date : 'today'
			}
		})
		
		function gopage(id){
			var store = $('.curStore').data('store') || 0;
			
			
			mui.openWindow({
			    url: 'saledetail.html', 
			    id:  id,
				extras : {
					store : store
				}
			 });
			//window.top.location.href = url +".html";  
		}


		
	</script>
</html>
